//tslint:disable
import { Pipe, PipeTransform } from '@angular/core';
// josn cssStyle 转换 "cssStyle":"color:#red" => {color: "red"}
@Pipe({
    name: 'styleFilter',
})
export class StylefilterPipe implements PipeTransform {
    transform(value: any, args?: any): any {
        if (value) {
            const newStyle = {};
            try {
                const cssStyles = value.split(";");
                for (let i = 0; i < cssStyles.length; i++) {
                    const cssStrs = cssStyles[i].split(":");
                    const index = cssStyles[i].indexOf(":");
                    if (index > 0) {
                      newStyle[cssStrs[0]] = cssStyles[i].substring(index + 1);
                    }
            
                  }
            } catch (error) {

            }
            return newStyle;
        }
    }
}
